package com.neutech.base;

import com.neutech.Util.ImageUtils;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class Boom extends Sprite implements Drawable {
   public transient  List<Image> imageList = new ArrayList<>();
    private double index = 0;

    public Boom(int x, int y, int width, int height) {
        super(x, y, width, height);
        this.loadingImg();
    }

    @Override
    public void draw(Graphics g) {
    if(imageList==null){
      imageList=new ArrayList<>();
      loadingImg();
    }

       /* index += 0.03;
        if (index > 2*//*放在前面，先判断在绘制*//*){
              index = 0;
        }*/
        index += 0.01;
        if (index > 2/*放在前面，先判断在绘制*/){
            index = 0;
        }
        g.drawImage(imageList.get((int) index++),getX(),getY(),null);

    }

    @Override
    public Rectangle getRectangle() {
        return new Rectangle(getX(),getY(),getWidth(),getHeight());
    }
    public void loadingImg(){
        imageList.add(ImageUtils.getValue("tank_sprite_309"));
        imageList.add(ImageUtils.getValue("tank_sprite_310"));
        imageList.add(ImageUtils.getValue("tank_sprite_311"));
    }


}
